package indi.kane.demandlist.controller;

import indi.kane.demandlist.entity.Demand;
import indi.kane.demandlist.service.impl.DemandService;
import indi.kane.demandlist.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName: DemandController
 * @Author: kane
 * @Date: 2020-05-08 11:12 上午
 * @Description:
 */
@RestController
@RequestMapping("demand")
public class DemandController {
    @Autowired
    private DemandService demandService;

    @RequestMapping("status")
    public ResultVo summaryStatus(){
        return demandService.summaryStatus();
    }

    @RequestMapping("all")
    public ResultVo loadAll(){
        return demandService.loadAll();
    }

    @PostMapping("add")
    public ResultVo add(@RequestBody Demand demand){
        return demandService.insert(demand);
    }

    @PostMapping("update")
    public ResultVo update(@RequestBody Demand demand){
        return  demandService.updateByPrimaryKey(demand);
    }

    @PostMapping("query")
    public ResultVo query(@RequestBody Demand demand){
        return demandService.query(demand);
    }
}